(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 9.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[      9196,        238]
NotebookOptionsPosition[      8840,        221]
NotebookOutlinePosition[      9186,        236]
CellTagsIndexPosition[      9143,        233]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData["\[IndentingNewLine]"], "Input",
 CellChangeTimes->{{3.6023247949108973`*^9, 3.602324818498139*^9}, 
   3.6023255351777973`*^9, 3.6023257881322417`*^9}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"<<", "TransferMatrixFormalism`Data`Indices`"}], 
   "\[IndentingNewLine]", 
   RowBox[{"Module", "[", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{
       RowBox[{"\[Omega]VIS", "=", "12518.8`"}], ",", 
       RowBox[{"\[Theta]VIS", "=", 
        RowBox[{"65.", "\[Degree]"}]}], ",", 
       RowBox[{"\[Theta]IR", "=", 
        RowBox[{"56.", "\[Degree]"}]}], ",", "nlist", ",", "nbarlist", ",", 
       RowBox[{"\[Omega]IR", "=", "1700"}], ",", 
       RowBox[{"dpdi", "=", "20"}], ",", 
       RowBox[{"dsio2", "=", "100"}]}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"nlist", "=", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{"1", ",", 
          RowBox[{"nPTCDIc8", "[", "#", "]"}], ",", 
          RowBox[{"nSiO2", "[", "#", "]"}], ",", 
          RowBox[{"nSi", "[", "#", "]"}]}], "}"}], "&"}]}], ";", 
      "\[IndentingNewLine]", 
      RowBox[{"nbarlist", "=", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
          RowBox[{"nPTCDIc8", "[", "#", "]"}], ",", 
          RowBox[{"nPTCDIc8", "[", "#", "]"}], ",", 
          RowBox[{"nSi", "[", "#", "]"}]}], "}"}], "&"}]}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"(*", 
       RowBox[{
        RowBox[{
         RowBox[{
          RowBox[{"(", 
           RowBox[{
            RowBox[{
             RowBox[{"Sqrt", "[", 
              RowBox[{"Abs", "[", 
               RowBox[{"M", "[", "d", "]"}], "]"}], "]"}], "*", 
             RowBox[{"Apply", "[", 
              RowBox[{"Plus", ",", 
               RowBox[{"LorentzianOSC", "[", 
                RowBox[{
                 RowBox[{"OutputTransferCArgs", "[", 
                  RowBox[{"[", "1", "]"}], "]"}], ",", 
                 RowBox[{"Table", "[", 
                  RowBox[{
                   RowBox[{"head", "[", 
                    RowBox[{"ele", ",", "dataset", ",", "v", ",", "r"}], 
                    "]"}], ",", 
                   RowBox[{"{", 
                    RowBox[{"head", ",", 
                    RowBox[{"{", 
                    RowBox[{"omega0", ",", "A", ",", "gamma"}], "}"}]}], 
                    "}"}], ",", 
                   RowBox[{"{", 
                    RowBox[{"ele", ",", "elements"}], "}"}], ",", 
                   RowBox[{"{", 
                    RowBox[{"v", ",", "numV"}], "}"}], ",", 
                   RowBox[{"{", 
                    RowBox[{"r", ",", "numR"}], "}"}]}], "]"}]}], "]"}], ",", 
               RowBox[{"{", "2", "}"}]}], "]"}]}], "+", 
            RowBox[{"Table", "[", 
             RowBox[{
              RowBox[{"ANR", "[", 
               RowBox[{"ele", ",", "dataset", ",", "v"}], "]"}], ",", 
              RowBox[{"{", 
               RowBox[{"ele", ",", "elements"}], "}"}], ",", 
              RowBox[{"{", 
               RowBox[{"v", ",", "numV"}], "}"}]}], "]"}]}], ")"}], "/.", 
          RowBox[{"OptionValue", "[", "\"\<ReplaceRules\>\"", "]"}]}], "/.", 
         RowBox[{"OptionValue", "[", "\"\<ConstraintRules\>\"", "]"}]}], 
        ";"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"(*", 
       RowBox[{"sspmodel", "=", 
        RowBox[{"Function", "[", 
         RowBox[{
          RowBox[{"{", 
           RowBox[{"dataset", ",", "dsio2", ",", "dpdi", ",", "\[Omega]IR"}], 
           "}"}], ","}]}]}], "*)"}], 
      RowBox[{
       RowBox[{"GenerateInterfacialModel", "[", 
        RowBox[{
         RowBox[{"{", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"{", 
            RowBox[{
             RowBox[{"{", 
              RowBox[{"0", ",", "1"}], "}"}], ",", "\[Omega]VIS", ",", 
             RowBox[{"RefractionAngle", "[", 
              RowBox[{"\[Theta]VIS", ",", "1", ",", 
               RowBox[{"nlist", "[", "\[Omega]VIS", "]"}]}], "]"}], ",", 
             RowBox[{"nlist", "[", "\[Omega]VIS", "]"}], ",", 
             RowBox[{
              RowBox[{"{", 
               RowBox[{"dpdi", ",", "dsio2"}], "}"}], " ", 
              SuperscriptBox["10", 
               RowBox[{"-", "7"}]]}], ",", 
             RowBox[{"nbarlist", "[", "\[Omega]VIS", "]"}]}], "}"}], ",", 
           RowBox[{"{", 
            RowBox[{
             RowBox[{"{", 
              RowBox[{"1", ",", "0"}], "}"}], ",", "\[Omega]IR", ",", 
             RowBox[{"RefractionAngle", "[", 
              RowBox[{"\[Theta]IR", ",", "1", ",", 
               RowBox[{"nlist", "[", "\[Omega]IR", "]"}]}], "]"}], ",", 
             RowBox[{"nlist", "[", "\[Omega]IR", "]"}], ",", 
             RowBox[{
              RowBox[{"{", 
               RowBox[{"dpdi", ",", "dsio2"}], "}"}], " ", 
              SuperscriptBox["10", 
               RowBox[{"-", "7"}]]}], ",", 
             RowBox[{"nbarlist", "[", "\[Omega]IR", "]"}]}], "}"}]}], "}"}], 
         ",", "\[IndentingNewLine]", 
         RowBox[{"Array", "[", 
          RowBox[{
           RowBox[{
            RowBox[{"If", "[", 
             RowBox[{
              RowBox[{
               RowBox[{"#3", "\[Equal]", "#2", "\[Equal]", "2"}], "&&", 
               RowBox[{"#4", "\[Equal]", "3"}]}], ",", "1", ",", "0"}], "]"}],
             "&"}], ",", 
           RowBox[{"{", 
            RowBox[{"3", ",", "3", ",", "3", ",", "3"}], "}"}]}], "]"}], ",", 
         "\[IndentingNewLine]", 
         RowBox[{"{", 
          RowBox[{
           RowBox[{"\[Omega]IR", "+", "\[Omega]VIS"}], ",", 
           RowBox[{"RefractionAngle", "[", 
            RowBox[{
             RowBox[{"PhaseMatchAngle", "[", 
              RowBox[{"{", 
               RowBox[{
                RowBox[{"{", 
                 RowBox[{"\[Omega]VIS", ",", "\[Theta]VIS"}], "}"}], ",", 
                RowBox[{"{", 
                 RowBox[{"\[Omega]IR", ",", "\[Theta]IR"}], "}"}]}], "}"}], 
              "]"}], ",", "1", ",", 
             RowBox[{"nlist", "[", 
              RowBox[{"\[Omega]IR", "+", "\[Omega]VIS"}], "]"}]}], "]"}], ",", 
           RowBox[{"nlist", "[", 
            RowBox[{"\[Omega]IR", "+", "\[Omega]VIS"}], "]"}], ",", 
           RowBox[{
            RowBox[{"{", 
             RowBox[{"dpdi", ",", "dsio2"}], "}"}], " ", 
            SuperscriptBox["10", 
             RowBox[{"-", "7"}]]}], ",", 
           RowBox[{"nbarlist", "[", 
            RowBox[{"\[Omega]IR", "+", "\[Omega]VIS"}], "]"}]}], "}"}]}], 
        "]"}], "/", "14000"}]}]}], "]"}]}]}]], "Input",
 CellChangeTimes->{{3.602324865391821*^9, 3.6023249416759553`*^9}, 
   3.602325379257924*^9, {3.602325520622972*^9, 3.602325532369793*^9}, {
   3.6023256525212035`*^9, 3.6023256557036095`*^9}, {3.6023257896766443`*^9, 
   3.602325792141449*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"0.`", "\[VeryThinSpace]", "+", 
      RowBox[{"0.`", " ", "\[ImaginaryI]"}]}], ",", 
     RowBox[{"1.3020483437567962`", "\[VeryThinSpace]", "+", 
      RowBox[{"1.0834810118169187`", " ", "\[ImaginaryI]"}]}], ",", 
     RowBox[{"0.`", "\[VeryThinSpace]", "+", 
      RowBox[{"0.`", " ", "\[ImaginaryI]"}]}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"0.`", "\[VeryThinSpace]", "+", 
      RowBox[{"0.`", " ", "\[ImaginaryI]"}]}], ",", 
     RowBox[{"0.9402772208930675`", "\[VeryThinSpace]", "+", 
      RowBox[{"1.1045234667725206`", " ", "\[ImaginaryI]"}]}], ",", 
     RowBox[{"0.`", "\[VeryThinSpace]", "+", 
      RowBox[{"0.`", " ", "\[ImaginaryI]"}]}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"0.`", "\[VeryThinSpace]", "+", 
      RowBox[{"0.`", " ", "\[ImaginaryI]"}]}], ",", 
     RowBox[{
      RowBox[{"-", "0.015168541792109864`"}], "-", 
      RowBox[{"0.016964016845164537`", " ", "\[ImaginaryI]"}]}], ",", 
     RowBox[{"0.`", "\[VeryThinSpace]", "+", 
      RowBox[{"0.`", " ", "\[ImaginaryI]"}]}]}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{{3.6023249237203236`*^9, 3.6023249533759756`*^9}, 
   3.602325090203816*^9, {3.602325355499082*^9, 3.6023253810363274`*^9}, 
   3.6023255393430047`*^9, {3.602325635797974*^9, 3.602325656608411*^9}, 
   3.602325793436251*^9}]
}, Open  ]]
},
WindowSize->{1102, 787},
WindowMargins->{{165, Automatic}, {36, Automatic}},
FrontEndVersion->"9.0 for Microsoft Windows (64-bit) (January 25, 2013)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[557, 20, 165, 2, 52, "Input"],
Cell[CellGroupData[{
Cell[747, 26, 6667, 159, 346, "Input"],
Cell[7417, 187, 1407, 31, 30, "Output"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
